<!DOCTYPE html>
<!DOCTYPE html>
<html lang="en">
<head>
    <title>生产信息编辑</title>
    {% include 'system/common/header.html' %}
</head>
<body>
<form class="layui-form" action="">
    <div class="mainBox">
        <div class="main-container">
            <div class="main-container">
                <div class="layui-form-item layui-hide">

                    <label class="layui-form-label">编号</label>
                    <div class="layui-input-block">
                        <input type="text" value="{{ info.id }}" name="id" lay-verify="title"
                               autocomplete="off" placeholder="请输入标题" class="layui-input">
                    </div>
                </div>
                 <div class="layui-form-item">
                    <label class="layui-form-label">生产指令单号</label>
                    <div class="layui-input-block">
                        <input type="text" name="生产指令单号" lay-verify="title" autocomplete="off" placeholder="请输入标题"
                               class="layui-input" value="{{ info.生产指令单号 }}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="名称" lay-verify="title" autocomplete="off" placeholder="请输入标题"
                               class="layui-input" value="{{ info.名称 }}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">规格</label>
                    <div class="layui-input-block">
                        <input type="text" name="规格" lay-verify="title" autocomplete="off" placeholder="请输入标题"
                               class="layui-input" value="{{ info.规格 }}" >
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">产地</label>
                    <div class="layui-input-block">
                        <input type="text" name="产地" lay-verify="title" autocomplete="off" placeholder="请输入标题"
                               class="layui-input" value="{{ info.产地 }}" >
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">批号</label>
                    <div class="layui-input-block">
                        <input type="text" name="批号" lay-verify="title" autocomplete="off" placeholder="请输入标题"
                               class="layui-input" value="{{ info.批号 }}" >
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">生产日期</label>
                    <div class="layui-input-block">
                        <input type="text" name="生产日期" lay-verify="title" autocomplete="off" placeholder="yyyy-MM-dd"
                               class="layui-input" value="{{ info.生产日期 }}"  id="ID-laydate-demo" >
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">代码</label>
                    <div class="layui-input-block">
                        <input type="text" name="代码" lay-verify="title" autocomplete="off" placeholder="请输入标题"
                               class="layui-input" value="{{ info.代码 }}">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">执行标准</label>
                    <div class="layui-input-block">
                        <input type="text" name="执行标准" lay-verify="title" autocomplete="off" placeholder="请输入标题"
                               class="layui-input" value="{{ info.执行标准 }}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">商品条码</label>
                    <div class="layui-input-block">
                        <input type="text" name="商品条码" lay-verify="title" autocomplete="off" placeholder="请输入标题"
                               class="layui-input" value="{{ info.商品条码 }}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">包装规格</label>
                    <div class="layui-input-block">
                        <input type="text" name="包装规格" lay-verify="title" autocomplete="off" placeholder="请输入标题"
                               class="layui-input" value="{{ info.包装规格 }}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">养护内容</label>
                    <div class="layui-input-block">
                        <input type="text" name="养护内容" lay-verify="title" autocomplete="off" placeholder="请输入标题"
                               class="layui-input" value="{{ info.养护内容 }}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">生产厂家</label>
                    <div class="layui-input-block">
                        <input type="text" name="生产厂家" lay-verify="title" autocomplete="off" placeholder="请输入标题"
                               class="layui-input" value="{{ info.生产厂家 }}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">生产地址</label>
                    <div class="layui-input-block">
                        <input type="text" name="生产地址" lay-verify="title" autocomplete="off" placeholder="请输入标题"
                               class="layui-input" value="{{ info.生产地址 }}">
                    </div>
                </div>


            </div>
        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit=""
                    lay-filter="user-update">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="pear-btn pear-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>
{% include 'system/common/footer.html' %}
<script>
    layui.use(['form', 'jquery', 'dtree'], function () {
        let form = layui.form
        let $ = layui.jquery
        let dtree = layui.dtree
        var laydate = layui.laydate;

          // 渲染
         laydate.render({
            elem: '#ID-laydate-demo'
          });

        form.on('submit(user-update)', function (data) {

            $.ajax({
                url: '/traceability/production/update',
                data: JSON.stringify(data.field),
                dataType: 'json',
                contentType: 'application/json',
                type: 'put',
                success: function (result) {
                    if (result.success) {
                        layer.msg(result.msg, {icon: 1, time: 1000}, function () {
                            parent.layer.close(parent.layer.getFrameIndex(window.name))//关闭当前页
                            parent.layui.table.reload('user-table')
                        })
                    } else {
                        layer.msg(result.msg, {icon: 2, time: 1000})
                    }
                }
            })
            return false
        })
    })
</script>
</body>
</html>